<template>
  <div class="newsinfo-container">
    <h3 class="title">{{ newsinfo.title }}</h3>
    <p class="info">
      <span>时间 {{ newsinfo.add_time }} </span>
      <span>点击 {{ newsinfo.click }} </span>
    </p>
    <hr>
    <div class="content" v-html="newsinfo.content">内容</div>

  <moment :newsid="id"></moment>

  </div>


</template>

<script>

import moment from '../sub-components/Comment.vue'

  export default{
    data(){
      return {
        newsinfo:{}
      };
    },
    methods:{
      async getNewsInfo(){
        const {data} = await this.$http.get("/api/getnew/" + this.id)
        // console.log(data)
        if(data.status === 0) return (this.newsinfo = data.message[0])
        // if(data.status === 0) return console.log(data.message[0])
        // if(data.status === 0) return console.log(data)
      }
    },
    created(){
      this.getNewsInfo()
    },
    props: ["id"],
    components:{
      moment
    }
  }
  
</script>

<style lang="scss" scoped>
.newsinfo-container{
  .title{
    color:red;
    font-size: 14px;
    text-align: center;
    margin: 10px 0;
  }
  .info{
    color: #26a2ff;
    display: flex;
    justify-content: space-between;
    margin: 0 10px;
  }
}
</style>


